#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <openssl/blowfish.h>
#include <openssl/md5.h>

int decrypt(char *data, unsigned long size)
{
	BF_KEY key;
	long i;
	unsigned char *k_data;
	unsigned char *hash;

	k_data = data + size;
	
	hash = MD5(data, (size_t)size, NULL);
	
	for(i = 0; i < 16; i++){
		k_data[i] = (hash[i] ^ k_data[i]);
	}

	BF_set_key(&key, 16, k_data);

	for(i = 0; i < size; i += 8){
		BF_ecb_encrypt(data+i, data+i, &key, BF_DECRYPT);
	}

	return 0;
}
